test(ethexe-runtime-common): Waitlist::wait debug_assert on duplicate id (auto-tester) b64c5073de45#5523
Draft
grishasobol wants to merge 1 commit into
Draft
Conversation
… id (auto-tester) b64c5073de45 Calling the public Waitlist::wait(dispatch, expiry) method twice with the same dispatch.id panics in debug builds via debug_assert!(r.is_none()) at state.rs:666. The signature accepts (Dispatch, u32) with no documented uniqueness precondition. In release builds the second wait silently overwrites the first; debug and release diverge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Calling the public
Waitlist::wait(dispatch, expiry)method twice with the samedispatch.idpanics in debug builds viadebug_assert!(r.is_none())atstate.rs:666. In release builds the second call silently overwrites the first — debug and release diverge.Scenario:
duplicate_keyHash:
b64c5073de45Unit:
ethexe-runtime-commonObserved
thread 'test_waitlist_wait_duplicate_id_debug_assert' panicked at ethexe/runtime/common/src/state.rs:666:9: assertion failed: r.is_none()Reproduces 3/3 deterministically.
Rubric items satisfied
pub fn wait(&mut self, dispatch: Dispatch, expiry: u32)atethexe/runtime/common/src/state.rs:656. No documented uniqueness precondition ondispatch.id.Dispatch::reply(...)is also a pub constructor and generates a deterministic id fromreply_to, so the caller can easily land on the same id twice through ordinary API usage.Root cause
BTreeMap::insertreturnsSome(old)on key collision; the debug_assert says "this should never happen". But:containsaccessor).Suggested fixes
Pick one:
Result<(), AlreadyWaiting>and let the caller decide.Practical reachability
Any actor that retries
waiton the same dispatch (after wakeup, after restart from snapshot, after queueing logic that produces the same Dispatch twice) hits this. Not as edge-case as the u32::MAX-block-height bug — duplicate dispatch ids can arise from non-pathological caller mistakes.Test source
Generated by
/gear-dev:tester(auto-tester). This is a draft PR — requires human review before merge.